from django.db import models
""" 
class LocationGames(models.Model):
    loc_id = models.IntegerField(primary_key=True)
    game_id = models.IntegerField(null=True, blank=True)
    level = models.IntegerField(null=True, blank=True)
    class Meta:
        db_table = u'location_games'

class LocationPhotos(models.Model):
    photo_id = models.IntegerField(primary_key=True)
    loc_id = models.IntegerField()
    dt_add = models.DateTimeField(null=True, blank=True)
    user_name = models.CharField(max_length=300, blank=True)
    user_id = models.IntegerField(null=True, blank=True)
    file = models.CharField(max_length=700, blank=True)
    size = models.IntegerField(null=True, blank=True)
    class Meta:
        db_table = u'location_photos'

class Locations(models.Model):
    loc_id = models.IntegerField(primary_key=True)
    loc_name = models.CharField(max_length=700, blank=True)
    loc_description = models.TextField(blank=True)
    lat = models.FloatField(null=True, blank=True)
    lng = models.FloatField(null=True, blank=True)
    district = models.CharField(max_length=300, blank=True)
    domain = models.CharField(max_length=150, blank=True)
    loc_type = models.CharField(max_length=18, blank=True)
    dt_add = models.DateTimeField(null=True, blank=True)
    class Meta:
        db_table = u'locations'

class Streets(models.Model):
    street_id = models.IntegerField(primary_key=True)
    title = models.CharField(max_length=700)
    lat = models.FloatField(null=True, blank=True)
    lng = models.FloatField(null=True, blank=True)
    domain = models.CharField(max_length=300)
    object_kind = models.CharField(max_length=15, blank=True)
    dt_add = models.DateTimeField(null=True, blank=True)
    city_name = models.CharField(max_length=250, blank=True)
    class Meta:
        db_table = u'streets'
"""
class GeoDb(models.Model):
    geoname_id = models.IntegerField()
    geoname = models.CharField(max_length=250)
    lat = models.FloatField(null=True, blank=True)
    lng = models.FloatField(null=True, blank=True)
    class Meta:
        db_table = u'geo_db'
    
    def empty_data(self):
        from django.db import connection
        cursor = connection.cursor()
        cursor.execute('TRUNCATE geo_db')
    
    def execute_raw_sql(self,sql):
        from django.db import connection
        cursor = connection.cursor()
        cursor.execute(sql)
        cursor.close()
        